
<template>
    <img src="" alt="">
    <van-button @click="changeLanguage('en')">点击切换语言</van-button>
</template>
<script setup>
import { reactive } from 'vue'
import { useI18n } from 'vue-i18n'
import content from "../person/content.vue";
const { locale } = useI18n()

const state = reactive({
  curLanguage: 'zh',
})

const changeLanguage = (lang = 'zh') => {
  state.curLanguage = lang
  locale.value = state.curLanguage
  //缓存到localStorage中下次进来还是切换后的语言
  localStorage.setItem('lang', lang)
}
</script>
<style scoped lang='less'>
.home {
    font-size: 20px;
}
</style>
